import Vue from 'vue'
import App from './App.vue'
import router from './router'
import { registerMicroApps ,runAfterFirstMounted ,start} from 'qiankun';

import ElementUI from 'element-ui';
import 'element-ui/lib/theme-chalk/index.css';

Vue.config.productionTip = false
Vue.use(ElementUI);

new Vue({
  router,
  render: h => h(App)
}).$mount('#app')

// load micro app
registerMicroApps([
  {
    name: 'childApp',
    entry: '//localhost:9000',
    container: '#child',
    activeRule : location => location.pathname.startsWith('/child'),
    props: {
      slogan: 'Hello Qiankun'
    },
  }
],{
    beforeLoad: app => console.log('before load', app.name),
    beforeMount: [
      app => console.log('before mount', app.name),
    ],
  });

  start();

  runAfterFirstMounted(()=>{
    console.log('run');
  })